package com.flying;

import java.util.Arrays;

/**
 * @author 刘鹏飞
 * @Classname TestArrays
 * @Date 2024/12/16 19:20
 * @Created by 刘鹏飞
 * @Description 测试Arrays工具类
 */
public class TestArrays {
    public static void main(String[] args) {

        String[] heroes={"百里守约","马可波罗","司马懿","曹操"};


        // toString()
        System.out.println(Arrays.toString(heroes));


        // copyOfRange()
        char[] cs={'2','a','b','c','d','e'};
        char[] chars = Arrays.copyOfRange(cs, 0, 4);
        System.out.println(Arrays.toString(chars));


        // compare
//        int compare = Arrays.compare(new int[]{0, 45, 25, 3}, new int[]{-1, 342, 42, 42});
//        System.out.println("compare = " + compare);




        // sort()  排序
        char[] char1={'2','a','b','f','d','z'};

        Arrays.sort(char1);
        System.out.println(Arrays.toString(char1));


    }

}
